//
//  BaseTabBarViewController.m
//  GiftItems
//
//  Created by lanou3g on 15/9/18.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "BaseTabBarViewController.h"
#import "ClassViewController.h"
#import "MainTableViewController.h"
#import "MineTableViewController.h"
#import "HotSellerTableViewController.h"
@interface BaseTabBarViewController ()

@end

@implementation BaseTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    

    
    MainTableViewController *mainVC = [[MainTableViewController alloc] initWithStyle:(UITableViewStylePlain)];
    [self addChildVC:mainVC title:@"首页" imageName:@"" selectedImage:@""];
    HotSellerTableViewController *hotVC = [[HotSellerTableViewController alloc] initWithStyle:(UITableViewStylePlain)];
    [self addChildVC:hotVC title:@"热卖" imageName:@"" selectedImage:@""];
    
    ClassViewController *classVC = [[ClassViewController alloc] init];
    [self addChildVC:classVC title:@"分类" imageName:@"" selectedImage:@""];
    
    
    MineTableViewController *mineVC = [[MineTableViewController alloc] init];
    [self addChildVC:mineVC title:@"我" imageName:@"" selectedImage:@""];
    
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)addChildVC:(UIViewController *)childVC title:(NSString *)title imageName:(NSString *)imageName selectedImage:(NSString *)selectedIamge {
    
    // 设置默认图标
    childVC.tabBarItem.image = [UIImage imageNamed:imageName];
    // 设置选中图标
    childVC.tabBarItem.selectedImage = [[UIImage imageNamed:selectedIamge] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    // 设置导航控制器
    UINavigationController *childNVC = [[UINavigationController alloc] initWithRootViewController:childVC];
    childNVC.tabBarItem.title = title;
    [self addChildViewController:childNVC];
    
    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
